package com.xuelang.pipeline.artifact.domain.resource.service.impl;

import com.xuelang.pipeline.artifact.client.common.result.PageRecord;
import com.xuelang.pipeline.artifact.client.resource.dto.ArtifactUserQuery;
import com.xuelang.pipeline.artifact.domain.resource.ArtifactUser;
import com.xuelang.pipeline.artifact.domain.resource.repository.ArtifactUserRepository;
import com.xuelang.pipeline.artifact.domain.resource.service.ArtifactUserDomainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 仓库用户领域服务实现类
 *
 * @author xiwen.zxg
 * @since 2024/5/15
 */
@Service
public class ArtifactUserDomainServiceImpl implements ArtifactUserDomainService {

    @Autowired
    private ArtifactUserRepository artifactUserRepository;

    @Override
    public PageRecord<ArtifactUser> pageList(long currentPage, long pageSize, ArtifactUserQuery artifactUserQuery) {
        return artifactUserRepository.pageList(currentPage, pageSize, artifactUserQuery);
    }

    @Override
    public List<ArtifactUser> list(ArtifactUserQuery artifactUserQuery) {
        return artifactUserRepository.list(artifactUserQuery);
    }


    @Override
    public Boolean save(ArtifactUser artifactUser) {
        return artifactUserRepository.save(artifactUser);
    }

    @Override
    public Boolean update(ArtifactUser artifactUser) {
        return artifactUserRepository.update(artifactUser);
    }

    @Override
    public Boolean delete(String artifactUserUuid) {
        return artifactUserRepository.delete(artifactUserUuid);
    }

    @Override
    public ArtifactUser query(String artifactUserUuid) {
        return artifactUserRepository.query(artifactUserUuid);
    }

    @Override
    public Boolean batchInsertArtifactUser(List<ArtifactUser> list) {
        return artifactUserRepository.batchInsertArtifactUser(list);
    }

    @Override
    public Boolean deleteByArtifactUuid(String artifactUuid) {
        return artifactUserRepository.deleteByArtifactUuid(artifactUuid);
    }

    @Override
    public ArtifactUser queryArtifactUser(String userId, String artifactToolUuid) {
        return artifactUserRepository.queryArtifactUser(userId, artifactToolUuid);
    }

    @Override
    public ArtifactUser queryArtifactUserByArtifactUserIdAndToolUuid(String pushUser, String artifactUuid) {
        return artifactUserRepository.queryArtifactUserByArtifactUserIdAndToolUuid(pushUser, artifactUuid);
    }

}
